<template>
  <div class="zoning">
        <div class="zoning-item" @click="ApplyMeetingHanlde">
          <div class="zoning-item-icon">
            <span v-if="userType === 10" class="iconfont icon-huiyishenqing2"></span>
            <span v-else class="iconfont icon-faqihuiyi1"></span>
          </div>
          <div class="zoning-item-title">
            <span class="primary"
              >{{
                userType === 20 || userType === 30 ? '发起' : '申请'
              }}会议</span
            >
            <span v-if="userType === 10" class="second">提前预约会议</span>
            <span v-else class="second">去发起会议</span>
          </div>
        </div>
         <div
          v-if="userType === 20 || userType === 30"
          class="zoning-item"
          @click="MeetingApprovalHanlde"
        >
          <div class="zoning-item-icon">
            <span class="tip" v-if="isApproval"></span>
            <span class="iconfont icon-huiyishenpi"></span>
          </div>
          <div class="zoning-item-title">
            <span class="primary">会议审批</span>
            <span class="second">去审批会议</span>
          </div>
        </div>
        <div class="zoning-item" @click="MeetingRecordHandle">
          <div class="zoning-item-icon">
            <span class="iconfont icon-huiyijilu"></span>
          </div>
          <div class="zoning-item-title">
            <span class="primary">会议记录</span>
            <span class="second">查看历史会议</span>
          </div>
        </div>
      </div>
</template>

<script>
import { useStore } from 'vuex'
import { useRouter } from 'vue-router'
import { computed } from 'vue'

export default {
  name: "Zoning",
  props: ["zoningItemFlex", "zoningHeight", "isApproval"],
  setup() {
    const store = useStore()
    const router = useRouter()
    // const number = computed(() => store.getters.getUserNumber)
    const userType = computed(() => store.getters.getUserType)

    // 跳转申请会议处理函数
    function ApplyMeetingHanlde() {
      router.push({
        path: '/applymeeting',
        query: {
          type: 0,
        },
      })
    }

    // 跳转会议记录处理函数
    function MeetingRecordHandle() {
      router.push('/meetingrecord')
    }

    // 会议审批处理函数
    function MeetingApprovalHanlde() {
      router.push('/meetingapproval')
    }

    return {
      userType,
      ApplyMeetingHanlde,
      MeetingRecordHandle,
      MeetingApprovalHanlde
    }
  }
}
</script>

<style lang="scss" scoped>
.zoning {
    width: 100%;
    height: v-bind(zoningHeight);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-sizing: border-box;
    padding: 1rem 1rem;

    .zoning-item {
      flex: 1;
      height: 100%;
      border-radius: 2vw;
      background-color: var(--item_background_color);
      box-sizing: border-box;
      padding: 1rem;
      display: flex;
      flex-direction: v-bind(zoningItemFlex);
      align-items: center;
      box-shadow: var(--box-shadow);

      &:active {
        color: var(--zoning-active-color);
        .zoning-item-title {
          .second {
            color: var(--zoning-active-color);
          }
        }
        // transition: var(--active-transition);
      }

      &:nth-child(2) {
        margin-left: 0.5rem;
      }
      &:nth-child(3) {
        margin-left: 0.5rem;
      }

      &-icon {
        width: 40%;
        height: 100%;
        display: flex;
        justify-content: center;
        align-items: center;
        position: relative;

        .tip {
          position: absolute;
          right: -0.2rem;
          top: 0.5rem;
          width: 0.8rem;
          height: 0.8rem;
          border-radius: 50%;
          background-color: var(--tip-backgrund-color);
        }
        .iconfont {
          font-size: 2.8rem;
          color: #4f73f9;
        }
        // background-color: red;
      }

      &-title {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;

        

        .primary {
          font-size: 1.6rem;
          font-weight: var(--primary-text-weight);
          margin-bottom: 1rem;
        }
        .second {
          color: var(--second-text-color);
          font-size: var(--second-text-size);
          font-weight: var(--second-text-weight);
        }
      }
    }
  }
</style>